/**
 * edurender
 * gler_main.c
 * (c) 2009 J. Brad Byrd
 */

#include "gler_context.h"

#include "../er/er_assert.h"
#include "../er/er_macros.h"

#include <windows.h>
#include <GL/gl.h>

#pragma warning(disable : 4100) // No "unreferenced formal parameter" warnings in this file.

static GLERContext *s_context = 0;

#define GLER_CHECK_CONTEXT() \
	if (s_context == NULL) \
	{ \
		return; \
	}

void APIENTRY glAccum_(GLenum op, GLfloat value)
{
	ER_ASSERT(0);
}

void APIENTRY glAlphaFunc_(GLenum func, GLclampf ref)
{
	// JBB_TODO: Implement me.
}

GLboolean APIENTRY glAreTexturesResident_(GLsizei n, const GLuint *textures,
	GLboolean *residences)
{
	ER_ASSERT(0);
	return GL_FALSE;
}

void APIENTRY glArrayElement_(GLint i)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glBegin_(GLenum mode)
{
	GLER_CHECK_CONTEXT();
	
	if (s_context->imm == ER_TRUE)
		return;

	s_context->imm = ER_TRUE;
	s_context->immPrim = mode;
	s_context->immIndex = 0;
}

void APIENTRY glBindTexture_(GLenum target, GLuint texture)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glBitmap_(GLsizei width, GLsizei height, GLfloat xorig,
	GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
{
	ER_ASSERT(0);
}

void APIENTRY glBlendFunc_(GLenum sfactor, GLenum dfactor)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glCallList_(GLuint list)
{
	ER_ASSERT(0);
}

void APIENTRY glCallLists_(GLsizei n, GLenum type, const GLvoid *lists)
{
	ER_ASSERT(0);
}

void APIENTRY glClear_(GLbitfield mask)
{
	GLER_CHECK_CONTEXT();
	
	if ((mask & GL_COLOR_BUFFER_BIT) != 0)
		erClearColorBuffer(s_context->er, 0.0f, 0.0f, 0.0f, 1.0f);
	
	if ((mask & GL_DEPTH_BUFFER_BIT) != 0)
		erClearDepthBuffer(s_context->er, 1.0f);
}

void APIENTRY glClearAccum_(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
{
	ER_ASSERT(0);
}

void APIENTRY glClearColor_(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glClearDepth_(GLclampd depth)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glClearIndex_(GLfloat c)
{
	ER_ASSERT(0);
}

void APIENTRY glClearStencil_(GLint s)
{
	ER_ASSERT(0);
}

void APIENTRY glClipPlane_(GLenum plane, const GLdouble *equation)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3b_(GLbyte red, GLbyte green, GLbyte blue)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3bv_(const GLbyte *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3d_(GLdouble red, GLdouble green, GLdouble blue)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3dv_(const GLdouble *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3f_(GLfloat red, GLfloat green, GLfloat blue)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glColor3fv_(const GLfloat *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3i_(GLint red, GLint green, GLint blue)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3iv_(const GLint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3s_(GLshort red, GLshort green, GLshort blue)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3sv_(const GLshort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3ub_(GLubyte red, GLubyte green, GLubyte blue)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3ubv_(const GLubyte *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3ui_(GLuint red, GLuint green, GLuint blue)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3uiv_(const GLuint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3us_(GLushort red, GLushort green, GLushort blue)
{
	ER_ASSERT(0);
}

void APIENTRY glColor3usv_(const GLushort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColor4b_(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
{
	ER_ASSERT(0);
}

void APIENTRY glColor4bv_(const GLbyte *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColor4d_(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
{
	ER_ASSERT(0);
}

void APIENTRY glColor4dv_(const GLdouble *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColor4f_(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
{
	//erswSetColor(red, green, blue, alpha);
}

void APIENTRY glColor4fv_(const GLfloat *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColor4i_(GLint red, GLint green, GLint blue, GLint alpha)
{
	ER_ASSERT(0);
}

void APIENTRY glColor4iv_(const GLint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColor4s_(GLshort red, GLshort green, GLshort blue, GLshort alpha)
{
	ER_ASSERT(0);
}

void APIENTRY glColor4sv_(const GLshort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColor4ub_(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
{
	ER_ASSERT(0);
}

void APIENTRY glColor4ubv_(const GLubyte *v)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glColor4ui_(GLuint red, GLuint green, GLuint blue, GLuint alpha)
{
	ER_ASSERT(0);
}

void APIENTRY glColor4uiv_(const GLuint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColor4us_(GLushort red, GLushort green, GLushort blue, GLushort alpha)
{
	ER_ASSERT(0);
}

void APIENTRY glColor4usv_(const GLushort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glColorMask_(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
{
	ER_ASSERT(0);
}

void APIENTRY glColorMaterial_(GLenum face, GLenum mode)
{
	ER_ASSERT(0);
}

void APIENTRY glColorPointer_(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glCopyPixels_(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
{
	ER_ASSERT(0);
}

void APIENTRY glCopyTexImage1D_(GLenum target, GLint level,
	GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border)
{
	ER_ASSERT(0);
}

void APIENTRY glCopyTexImage2D_(GLenum target, GLint level,
	GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
{
	ER_ASSERT(0);
}

void APIENTRY glCopyTexSubImage1D_(GLenum target, GLint level,
	GLint xoffset, GLint x, GLint y, GLsizei width)
{
	ER_ASSERT(0);
}

void APIENTRY glCopyTexSubImage2D_(GLenum target, GLint level,
	GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
{
	ER_ASSERT(0);
}

void APIENTRY glCullFace_(GLenum mode)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glDeleteLists_(GLuint list, GLsizei range)
{
	ER_ASSERT(0);
}

void APIENTRY glDeleteTextures_(GLsizei n, const GLuint *textures)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glDepthFunc_(GLenum func)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glDepthMask_(GLboolean flag)
{
	erSetDepthMask(s_context->er, flag ? ER_TRUE : ER_FALSE);
}

void APIENTRY glDepthRange_(GLclampd zNear, GLclampd zFar)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glDisable_(GLenum cap)
{
	GLER_CHECK_CONTEXT();

	switch (cap)
	{
		case GL_DEPTH_TEST:
			erSetDepthTest(s_context->er, ER_FALSE);
			break;
	}
}

void APIENTRY glDisableClientState_(GLenum array)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glDrawArrays_(GLenum mode, GLint first, GLsizei count)
{
	ER_ASSERT(0);
}

void APIENTRY glDrawBuffer_(GLenum mode)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glDrawElements_(GLenum mode, GLsizei count,
	GLenum type, const GLvoid *indices)
{
	ER_ASSERT(0);
}

void APIENTRY glDrawPixels_(GLsizei width, GLsizei height,
	GLenum format, GLenum type, const GLvoid *pixels)
{
	ER_ASSERT(0);
}

void APIENTRY glEdgeFlag_(GLboolean flag)
{
	ER_ASSERT(0);
}

void APIENTRY glEdgeFlagPointer_(GLsizei stride, const GLvoid *pointer)
{
	ER_ASSERT(0);
}

void APIENTRY glEdgeFlagv_(const GLboolean *flag)
{
	ER_ASSERT(0);
}

void APIENTRY glEnable_(GLenum cap)
{
	GLER_CHECK_CONTEXT();

	switch (cap)
	{
		case GL_DEPTH_TEST:
			erSetDepthTest(s_context->er, ER_TRUE);
			break;
	}
}

void APIENTRY glEnableClientState_(GLenum array)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glEnd_(void)
{
	GLER_CHECK_CONTEXT();
	
	if (s_context->imm == GL_FALSE)
		return;
	
	erSetMatrix(s_context->er, ER_MATRIX_MODELVIEW, ER_MATRIX_STORAGE_ROW_MAJOR, &s_context->mvStack[s_context->mvIndex]._00);
	erSetMatrix(s_context->er, ER_MATRIX_PROJECTION, ER_MATRIX_STORAGE_ROW_MAJOR, &s_context->projStack[s_context->projIndex]._00);

	erSetPositionArray(s_context->er, sizeof(ERVector3f), &s_context->immVerts[0].x);

	switch (s_context->immPrim)
	{
		case GL_TRIANGLES:
			erDraw(s_context->er, ER_PRIMITIVE_TRIANGLES, s_context->immIndex, 0);
			break;
		
		case GL_TRIANGLE_STRIP:
			erDraw(s_context->er, ER_PRIMITIVE_TRIANGLE_STRIP, s_context->immIndex, 0);
			break;
			
		case GL_QUADS:
			erDraw(s_context->er, ER_PRIMITIVE_QUADS, s_context->immIndex, 0);
			break;
	}
	
	s_context->imm = ER_FALSE;
}

void APIENTRY glEndList_(void)
{
	ER_ASSERT(0);
}

void APIENTRY glEvalCoord1d_(GLdouble u)
{
	ER_ASSERT(0);
}

void APIENTRY glEvalCoord1dv_(const GLdouble *u)
{
	ER_ASSERT(0);
}

void APIENTRY glEvalCoord1f_(GLfloat u)
{
	ER_ASSERT(0);
}

void APIENTRY glEvalCoord1fv_(const GLfloat *u)
{
	ER_ASSERT(0);
}

void APIENTRY glEvalCoord2d_(GLdouble u, GLdouble v)
{
	ER_ASSERT(0);
}

void APIENTRY glEvalCoord2dv_(const GLdouble *u)
{
	ER_ASSERT(0);
}

void APIENTRY glEvalCoord2f_(GLfloat u, GLfloat v)
{
	ER_ASSERT(0);
}

void APIENTRY glEvalCoord2fv_(const GLfloat *u)
{
	ER_ASSERT(0);
}

void APIENTRY glEvalMesh1_(GLenum mode, GLint i1, GLint i2)
{
	ER_ASSERT(0);
}

void APIENTRY glEvalMesh2_(GLenum mode, GLint i1,
	GLint i2, GLint j1, GLint j2)
{
	ER_ASSERT(0);
}

void APIENTRY glEvalPoint1_(GLint i)
{
	ER_ASSERT(0);
}

void APIENTRY glEvalPoint2_(GLint i, GLint j)
{
	ER_ASSERT(0);
}

void APIENTRY glFeedbackBuffer_(GLsizei size,
	GLenum type, GLfloat *buffer)
{
	ER_ASSERT(0);
}

void APIENTRY glFinish_(void)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glFlush_(void)
{
	ER_ASSERT(0);
}

void APIENTRY glFogf_(GLenum pname, GLfloat param)
{
	ER_ASSERT(0);
}

void APIENTRY glFogfv_(GLenum pname, const GLfloat *params)
{
	ER_ASSERT(0);
}

void APIENTRY glFogi_(GLenum pname, GLint param)
{
	ER_ASSERT(0);
}

void APIENTRY glFogiv_(GLenum pname, const GLint *params)
{
	ER_ASSERT(0);
}

void APIENTRY glFrontFace_(GLenum mode)
{
	ER_ASSERT(0);
}

void APIENTRY glFrustum_(GLdouble left, GLdouble right,
	GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
{
	ER_ASSERT(0);
}

GLuint APIENTRY glGenLists_(GLsizei range)
{
	return 0;
}

void APIENTRY glGenTextures_(GLsizei n, GLuint *textures)
{
	ER_ASSERT(0);
}

void APIENTRY glGetBooleanv_(GLenum pname, GLboolean *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetClipPlane_(GLenum plane, GLdouble *equation)
{
	ER_ASSERT(0);
}

void APIENTRY glGetDoublev_(GLenum pname, GLdouble *params)
{
	ER_ASSERT(0);
}

GLenum APIENTRY glGetError_(void)
{
	// JBB_TODO: Implement me.

	return GL_NO_ERROR;
}

void APIENTRY glGetFloatv_(GLenum pname, GLfloat *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetIntegerv_(GLenum pname, GLint *params)
{
	if (pname == GL_MAX_TEXTURE_SIZE)
	{
		*params = 1024;
		return;
	}

	ER_ASSERT(0);
}

void APIENTRY glGetLightfv_(GLenum light, GLenum pname, GLfloat *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetLightiv_(GLenum light, GLenum pname, GLint *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetMapdv_(GLenum target, GLenum query, GLdouble *v)
{
	ER_ASSERT(0);
}

void APIENTRY glGetMapfv_(GLenum target, GLenum query, GLfloat *v)
{
	ER_ASSERT(0);
}

void APIENTRY glGetMapiv_(GLenum target, GLenum query, GLint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glGetMaterialfv_(GLenum face, GLenum pname, GLfloat *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetMaterialiv_(GLenum face, GLenum pname, GLint *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetPixelMapfv_(GLenum map, GLfloat *values)
{
	ER_ASSERT(0);
}

void APIENTRY glGetPixelMapuiv_(GLenum map, GLuint *values)
{
	ER_ASSERT(0);
}

void APIENTRY glGetPixelMapusv_(GLenum map, GLushort *values)
{
	ER_ASSERT(0);
}

void APIENTRY glGetPointerv_(GLenum pname, GLvoid* *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetPolygonStipple_(GLubyte *mask)
{
	ER_ASSERT(0);
}

const GLubyte *APIENTRY glGetString_(GLenum name)
{
	switch (name)
	{
		case GL_VENDOR:
			return (GLubyte *)"J. Brad Byrd";
			
		case GL_RENDERER:
			return (GLubyte *)"Edurender Software";
			
		case GL_VERSION:
			return (GLubyte *)"1.0";
		
		case GL_EXTENSIONS:
			return (GLubyte *)"";
	}

	ER_ASSERT(0);
	
	return NULL;
}

void APIENTRY glGetTexEnvfv_(GLenum target, GLenum pname, GLfloat *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetTexEnviv_(GLenum target, GLenum pname, GLint *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetTexGendv_(GLenum coord, GLenum pname, GLdouble *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetTexGenfv_(GLenum coord, GLenum pname, GLfloat *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetTexGeniv_(GLenum coord, GLenum pname, GLint *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetTexImage_(GLenum target, GLint level, GLenum format,
	GLenum type, GLvoid *pixels)
{
	ER_ASSERT(0);
}

void APIENTRY glGetTexLevelParameterfv_(GLenum target, GLint level,
	GLenum pname, GLfloat *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetTexLevelParameteriv_(GLenum target, GLint level,
	GLenum pname, GLint *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetTexParameterfv_(GLenum target, GLenum pname, GLfloat *params)
{
	ER_ASSERT(0);
}

void APIENTRY glGetTexParameteriv_(GLenum target, GLenum pname, GLint *params)
{
	ER_ASSERT(0);
}

void APIENTRY glHint_(GLenum target, GLenum mode)
{
	ER_ASSERT(0);
}

void APIENTRY glIndexMask_(GLuint mask)
{
	ER_ASSERT(0);
}

void APIENTRY glIndexPointer_(GLenum type, GLsizei stride, const GLvoid *pointer)
{
	ER_ASSERT(0);
}

void APIENTRY glIndexd_(GLdouble c)
{
	ER_ASSERT(0);
}

void APIENTRY glIndexdv_(const GLdouble *c)
{
	ER_ASSERT(0);
}

void APIENTRY glIndexf_(GLfloat c)
{
	ER_ASSERT(0);
}

void APIENTRY glIndexfv_(const GLfloat *c)
{
	ER_ASSERT(0);
}

void APIENTRY glIndexi_(GLint c)
{
	ER_ASSERT(0);
}

void APIENTRY glIndexiv_(const GLint *c)
{
	ER_ASSERT(0);
}

void APIENTRY glIndexs_(GLshort c)
{
	ER_ASSERT(0);
}

void APIENTRY glIndexsv_(const GLshort *c)
{
	ER_ASSERT(0);
}

void APIENTRY glIndexub_(GLubyte c)
{
	ER_ASSERT(0);
}

void APIENTRY glIndexubv_(const GLubyte *c)
{
	ER_ASSERT(0);
}

void APIENTRY glInitNames_(void)
{
	ER_ASSERT(0);
}

void APIENTRY glInterleavedArrays_(GLenum format, GLsizei stride,
	const GLvoid *pointer)
{
	ER_ASSERT(0);
}

GLboolean APIENTRY glIsEnabled_(GLenum cap)
{
	ER_ASSERT(0);
	return GL_FALSE;
}

GLboolean APIENTRY glIsList_(GLuint list)
{
	ER_ASSERT(0);
	return GL_FALSE;
}

GLboolean APIENTRY glIsTexture_(GLuint texture)
{
	ER_ASSERT(0);
	return GL_FALSE;
}

void APIENTRY glLightModelf_(GLenum pname, GLfloat param)
{
	ER_ASSERT(0);
}

void APIENTRY glLightModelfv_(GLenum pname, const GLfloat *params)
{
	ER_ASSERT(0);
}

void APIENTRY glLightModeli_(GLenum pname, GLint param)
{
	ER_ASSERT(0);
}

void APIENTRY glLightModeliv_(GLenum pname, const GLint *params)
{
	ER_ASSERT(0);
}

void APIENTRY glLightf_(GLenum light, GLenum pname, GLfloat param)
{
	ER_ASSERT(0);
}

void APIENTRY glLightfv_(GLenum light, GLenum pname, const GLfloat *params)
{
	ER_ASSERT(0);
}

void APIENTRY glLighti_(GLenum light, GLenum pname, GLint param)
{
	ER_ASSERT(0);
}

void APIENTRY glLightiv_(GLenum light, GLenum pname, const GLint *params)
{
	ER_ASSERT(0);
}

void APIENTRY glLineStipple_(GLint factor, GLushort pattern)
{
	ER_ASSERT(0);
}

void APIENTRY glLineWidth_(GLfloat width)
{
	ER_ASSERT(0);
}

void APIENTRY glListBase_(GLuint base)
{
	ER_ASSERT(0);
}

void APIENTRY glLoadIdentity_(void)
{
	GLER_CHECK_CONTEXT();
	
	switch (s_context->matrixMode)
	{
		case GL_MODELVIEW:
			erIdentityMatrix(&s_context->mvStack[s_context->mvIndex]);
			break;
			
		case GL_PROJECTION:
			erIdentityMatrix(&s_context->projStack[s_context->projIndex]);
			break;
	}
}

void APIENTRY glLoadMatrixd_(const GLdouble *m)
{
	ER_ASSERT(0);
}

void APIENTRY glLoadMatrixf_(const GLfloat *m)
{
	ERMatrix4x4f *dst = NULL;
	
	GLER_CHECK_CONTEXT();
	
	switch (s_context->matrixMode)
	{
		case GL_MODELVIEW:
			dst = &s_context->mvStack[s_context->mvIndex];
			break;
			
		case GL_PROJECTION:
			dst = &s_context->projStack[s_context->projIndex];
			break;
	}
	
	if (dst != NULL)
		erTransposeMatrix(dst, (const ERMatrix4x4f *)m);
		//memcpy(dst, m, sizeof(GLfloat) * 16);
}

void APIENTRY glLoadName_(GLuint name)
{
	ER_ASSERT(0);
}

void APIENTRY glLogicOp_(GLenum opcode)
{
	ER_ASSERT(0);
}

void APIENTRY glMap1d_(GLenum target, GLdouble u1, GLdouble u2,
	GLint stride, GLint order, const GLdouble *points)
{
	ER_ASSERT(0);
}

void APIENTRY glMap1f_(GLenum target, GLfloat u1, GLfloat u2,
	GLint stride, GLint order, const GLfloat *points)
{
	ER_ASSERT(0);
}

void APIENTRY glMap2d_(GLenum target, GLdouble u1, GLdouble u2,
	GLint ustride, GLint uorder, GLdouble v1, GLdouble v2,
	GLint vstride, GLint vorder, const GLdouble *points)
{
	ER_ASSERT(0);
}

void APIENTRY glMap2f_(GLenum target, GLfloat u1, GLfloat u2,
	GLint ustride, GLint uorder, GLfloat v1, GLfloat v2,
	GLint vstride, GLint vorder, const GLfloat *points)
{
	ER_ASSERT(0);
}

void APIENTRY glMapGrid1d_(GLint un, GLdouble u1, GLdouble u2)
{
	ER_ASSERT(0);
}

void APIENTRY glMapGrid1f_(GLint un, GLfloat u1, GLfloat u2)
{
	ER_ASSERT(0);
}

void APIENTRY glMapGrid2d_(GLint un, GLdouble u1, GLdouble u2,
	GLint vn, GLdouble v1, GLdouble v2)
{
	ER_ASSERT(0);
}

void APIENTRY glMapGrid2f_(GLint un, GLfloat u1, GLfloat u2,
	GLint vn, GLfloat v1, GLfloat v2)
{
	ER_ASSERT(0);
}

void APIENTRY glMaterialf_(GLenum face, GLenum pname, GLfloat param)
{
	ER_ASSERT(0);
}

void APIENTRY glMaterialfv_(GLenum face, GLenum pname, const GLfloat *params)
{
	ER_ASSERT(0);
}

void APIENTRY glMateriali_(GLenum face, GLenum pname, GLint param)
{
	ER_ASSERT(0);
}

void APIENTRY glMaterialiv_(GLenum face, GLenum pname, const GLint *params)
{
	ER_ASSERT(0);
}

void APIENTRY glMatrixMode_(GLenum mode)
{
	GLER_CHECK_CONTEXT();
	
	s_context->matrixMode = mode;
}

void APIENTRY glMultMatrixd_(const GLdouble *m)
{
	ER_ASSERT(0);
}

void APIENTRY glMultMatrixf_(const GLfloat *m)
{
	ER_ASSERT(0);
}

void APIENTRY glNewList_(GLuint list, GLenum mode)
{
	ER_ASSERT(0);
}

void APIENTRY glNormal3b_(GLbyte nx, GLbyte ny, GLbyte nz)
{
	ER_ASSERT(0);
}

void APIENTRY glNormal3bv_(const GLbyte *v)
{
	ER_ASSERT(0);
}

void APIENTRY glNormal3d_(GLdouble nx, GLdouble ny, GLdouble nz)
{
	ER_ASSERT(0);
}

void APIENTRY glNormal3dv_(const GLdouble *v)
{
	ER_ASSERT(0);
}

void APIENTRY glNormal3f_(GLfloat nx, GLfloat ny, GLfloat nz)
{
	ER_ASSERT(0);
}

void APIENTRY glNormal3fv_(const GLfloat *v)
{
	ER_ASSERT(0);
}

void APIENTRY glNormal3i_(GLint nx, GLint ny, GLint nz)
{
	ER_ASSERT(0);
}

void APIENTRY glNormal3iv_(const GLint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glNormal3s_(GLshort nx, GLshort ny, GLshort nz)
{
	ER_ASSERT(0);
}

void APIENTRY glNormal3sv_(const GLshort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glNormalPointer_(GLenum type, GLsizei stride, const GLvoid *pointer)
{
	ER_ASSERT(0);
}

void APIENTRY glOrtho_(GLdouble left, GLdouble right, GLdouble bottom,
	GLdouble top, GLdouble zNear, GLdouble zFar)
{
	ERMatrix4x4f ortho;
	ERMatrix4x4f *dst = NULL;
	
	GLER_CHECK_CONTEXT();
	
	erIdentityMatrix(&ortho);
	
	ortho._00 =  2.0f / (float)(right - left);
	ortho._11 =  2.0f / (float)(top - bottom);
	ortho._22 = -2.0f / (float)(zFar - zNear);
	
	ortho._03 = -(float)(right + left) / (float)(right - left);
	ortho._13 = -(float)(top + bottom) / (float)(top - bottom);
	ortho._23 = -(float)(zFar + zNear) / (float)(zFar - zNear);
	
	switch (s_context->matrixMode)
	{
		case GL_MODELVIEW:
			dst = &s_context->mvStack[s_context->mvIndex];
			break;
		
		case GL_PROJECTION:
			dst = &s_context->projStack[s_context->projIndex];
			break;
	}

	if (dst != NULL)
		erMulMatrix(dst, dst, &ortho);

	/*
	*/
}

void APIENTRY glPassThrough_(GLfloat token)
{
	ER_ASSERT(0);
}

void APIENTRY glPixelMapfv_(GLenum map, GLsizei mapsize, const GLfloat *values)
{
	ER_ASSERT(0);
}

void APIENTRY glPixelMapuiv_(GLenum map, GLsizei mapsize, const GLuint *values)
{
	ER_ASSERT(0);
}

void APIENTRY glPixelMapusv_(GLenum map, GLsizei mapsize, const GLushort *values)
{
	ER_ASSERT(0);
}

void APIENTRY glPixelStoref_(GLenum pname, GLfloat param)
{
	ER_ASSERT(0);
}

void APIENTRY glPixelStorei_(GLenum pname, GLint param)
{
	ER_ASSERT(0);
}

void APIENTRY glPixelTransferf_(GLenum pname, GLfloat param)
{
	ER_ASSERT(0);
}

void APIENTRY glPixelTransferi_(GLenum pname, GLint param)
{
	ER_ASSERT(0);
}

void APIENTRY glPixelZoom_(GLfloat xfactor, GLfloat yfactor)
{
	ER_ASSERT(0);
}

void APIENTRY glPointSize_(GLfloat size)
{
	ER_ASSERT(0);
}

void APIENTRY glPolygonMode_(GLenum face, GLenum mode)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glPolygonOffset_(GLfloat factor, GLfloat units)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glPolygonStipple_(const GLubyte *mask)
{
	ER_ASSERT(0);
}

void APIENTRY glPopAttrib_(void)
{
	ER_ASSERT(0);
}

void APIENTRY glPopClientAttrib_(void)
{
	ER_ASSERT(0);
}

void APIENTRY glPopMatrix_(void)
{
	ER_ASSERT(0);
}

void APIENTRY glPopName_(void)
{
	ER_ASSERT(0);
}

void APIENTRY glPrioritizeTextures_(GLsizei n, const GLuint *textures,
	const GLclampf *priorities)
{
	ER_ASSERT(0);
}

void APIENTRY glPushAttrib_(GLbitfield mask)
{
	ER_ASSERT(0);
}

void APIENTRY glPushClientAttrib_(GLbitfield mask)
{
	ER_ASSERT(0);
}

void APIENTRY glPushMatrix_(void)
{
	ER_ASSERT(0);
}

void APIENTRY glPushName_(GLuint name)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos2d_(GLdouble x, GLdouble y)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos2dv_(const GLdouble *v)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos2f_(GLfloat x, GLfloat y)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos2fv_(const GLfloat *v)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos2i_(GLint x, GLint y)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos2iv_(const GLint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos2s_(GLshort x, GLshort y)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos2sv_(const GLshort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos3d_(GLdouble x, GLdouble y, GLdouble z)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos3dv_(const GLdouble *v)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos3f_(GLfloat x, GLfloat y, GLfloat z)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos3fv_(const GLfloat *v)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos3i_(GLint x, GLint y, GLint z)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos3iv_(const GLint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos3s_(GLshort x, GLshort y, GLshort z)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos3sv_(const GLshort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos4d_(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos4dv_(const GLdouble *v)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos4f_(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos4fv_(const GLfloat *v)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos4i_(GLint x, GLint y, GLint z, GLint w)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos4iv_(const GLint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos4s_(GLshort x, GLshort y, GLshort z, GLshort w)
{
	ER_ASSERT(0);
}

void APIENTRY glRasterPos4sv_(const GLshort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glReadBuffer_(GLenum mode)
{
	ER_ASSERT(0);
}

void APIENTRY glReadPixels_(GLint x, GLint y, GLsizei width, GLsizei height,
	GLenum format, GLenum type, GLvoid *pixels)
{
	ER_ASSERT(0);
}

void APIENTRY glRectd_(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
{
	ER_ASSERT(0);
}

void APIENTRY glRectdv_(const GLdouble *v1, const GLdouble *v2)
{
	ER_ASSERT(0);
}

void APIENTRY glRectf_(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
{
	ER_ASSERT(0);
}

void APIENTRY glRectfv_(const GLfloat *v1, const GLfloat *v2)
{
	ER_ASSERT(0);
}

void APIENTRY glRecti_(GLint x1, GLint y1, GLint x2, GLint y2)
{
	ER_ASSERT(0);
}

void APIENTRY glRectiv_(const GLint *v1, const GLint *v2)
{
	ER_ASSERT(0);
}

void APIENTRY glRects_(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
{
	ER_ASSERT(0);
}

void APIENTRY glRectsv_(const GLshort *v1, const GLshort *v2)
{
	ER_ASSERT(0);
}

GLint APIENTRY glRenderMode_(GLenum mode)
{
	ER_ASSERT(0);
	return GL_RENDER;
}

void APIENTRY glRotated_(GLdouble answe, GLdouble x, GLdouble y, GLdouble z)
{
	ER_ASSERT(0);
}

void APIENTRY glRotatef_(GLfloat answe, GLfloat x, GLfloat y, GLfloat z)
{
	ER_ASSERT(0);
}

void APIENTRY glScaled_(GLdouble x, GLdouble y, GLdouble z)
{
	ER_ASSERT(0);
}

void APIENTRY glScalef_(GLfloat x, GLfloat y, GLfloat z)
{
	ER_ASSERT(0);
}

void APIENTRY glScissor_(GLint x, GLint y, GLsizei width, GLsizei height)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glSelectBuffer_(GLsizei size, GLuint *buffer)
{
	ER_ASSERT(0);
}

void APIENTRY glShadeModel_(GLenum mode)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glStencilFunc_(GLenum func, GLint ref, GLuint mask)
{
	ER_ASSERT(0);
}

void APIENTRY glStencilMask_(GLuint mask)
{
	ER_ASSERT(0);
}

void APIENTRY glStencilOp_(GLenum fail, GLenum zfail, GLenum zpass)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord1d_(GLdouble s)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord1dv_(const GLdouble *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord1f_(GLfloat s)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord1fv_(const GLfloat *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord1i_(GLint s)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord1iv_(const GLint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord1s_(GLshort s)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord1sv_(const GLshort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord2d_(GLdouble s, GLdouble t)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord2dv_(const GLdouble *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord2f_(GLfloat s, GLfloat t)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glTexCoord2fv_(const GLfloat *v)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glTexCoord2i_(GLint s, GLint t)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord2iv_(const GLint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord2s_(GLshort s, GLshort t)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord2sv_(const GLshort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord3d_(GLdouble s, GLdouble t, GLdouble r)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord3dv_(const GLdouble *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord3f_(GLfloat s, GLfloat t, GLfloat r)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord3fv_(const GLfloat *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord3i_(GLint s, GLint t, GLint r)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord3iv_(const GLint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord3s_(GLshort s, GLshort t, GLshort r)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord3sv_(const GLshort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord4d_(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord4dv_(const GLdouble *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord4f_(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord4fv_(const GLfloat *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord4i_(GLint s, GLint t, GLint r, GLint q)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord4iv_(const GLint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord4s_(GLshort s, GLshort t, GLshort r, GLshort q)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoord4sv_(const GLshort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glTexCoordPointer_(GLint size, GLenum type,
	GLsizei stride, const GLvoid *pointer)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glTexEnvf_(GLenum target, GLenum pname, GLfloat param)
{
	// JBB_TODO: Implement me!
}

void APIENTRY glTexEnvfv_(GLenum target, GLenum pname, const GLfloat *params)
{
	ER_ASSERT(0);
}

void APIENTRY glTexEnvi_(GLenum target, GLenum pname, GLint param)
{
	ER_ASSERT(0);
}

void APIENTRY glTexEnviv_(GLenum target, GLenum pname, const GLint *params)
{
	ER_ASSERT(0);
}

void APIENTRY glTexGend_(GLenum coord, GLenum pname, GLdouble param)
{
	ER_ASSERT(0);
}

void APIENTRY glTexGendv_(GLenum coord, GLenum pname, const GLdouble *params)
{
	ER_ASSERT(0);
}

void APIENTRY glTexGenf_(GLenum coord, GLenum pname, GLfloat param)
{
	ER_ASSERT(0);
}

void APIENTRY glTexGenfv_(GLenum coord, GLenum pname, const GLfloat *params)
{
	ER_ASSERT(0);
}

void APIENTRY glTexGeni_(GLenum coord, GLenum pname, GLint param)
{
	ER_ASSERT(0);
}

void APIENTRY glTexGeniv_(GLenum coord, GLenum pname, const GLint *params)
{
	ER_ASSERT(0);
}

void APIENTRY glTexImage1D_(GLenum target, GLint level, GLint internalformat,
	GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
{
	ER_ASSERT(0);
}

void APIENTRY glTexImage2D_(GLenum target, GLint level, GLint internalformat,
	GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type,
	const GLvoid *pixels)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glTexParameterf_(GLenum target, GLenum pname, GLfloat param)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glTexParameterfv_(GLenum target, GLenum pname, const GLfloat *params)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glTexParameteri_(GLenum target, GLenum pname, GLint param)
{
	ER_ASSERT(0);
}

void APIENTRY glTexParameteriv_(GLenum target, GLenum pname, const GLint *params)
{
	ER_ASSERT(0);
}

void APIENTRY glTexSubImage1D_(GLenum target, GLint level, GLint xoffset,
	GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
{
	ER_ASSERT(0);
}

void APIENTRY glTexSubImage2D_(GLenum target, GLint level, GLint xoffset,
	GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
	const GLvoid *pixels)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glTranslated_(GLdouble x, GLdouble y, GLdouble z)
{
	ER_ASSERT(0);
}

void APIENTRY glTranslatef_(GLfloat x, GLfloat y, GLfloat z)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex2d_(GLdouble x, GLdouble y)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex2dv_(const GLdouble *v)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex2f_(GLfloat x, GLfloat y)
{
	ERVector3f *v;
	
	GLER_CHECK_CONTEXT();
	
	if (s_context->imm == GL_FALSE)
		return;
	
	v = &s_context->immVerts[s_context->immIndex];
	v->x = x;
	v->y = y;
	v->z = 0.0f;
	
	s_context->immIndex++;
}

void APIENTRY glVertex2fv_(const GLfloat *v)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex2i_(GLint x, GLint y)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex2iv_(const GLint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex2s_(GLshort x, GLshort y)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex2sv_(const GLshort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex3d_(GLdouble x, GLdouble y, GLdouble z)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex3dv_(const GLdouble *v)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex3f_(GLfloat x, GLfloat y, GLfloat z)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex3fv_(const GLfloat *v)
{
	ERVector3f *dst;
	
	GLER_CHECK_CONTEXT();
	
	if (s_context->imm == GL_FALSE)
		return;
	
	dst = &s_context->immVerts[s_context->immIndex];
	dst->x = *v++;
	dst->y = *v++;
	dst->z = *v;
	
	s_context->immIndex++;
}

void APIENTRY glVertex3i_(GLint x, GLint y, GLint z)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex3iv_(const GLint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex3s_(GLshort x, GLshort y, GLshort z)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex3sv_(const GLshort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex4d_(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex4dv_(const GLdouble *v)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex4f_(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex4fv_(const GLfloat *v)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex4i_(GLint x, GLint y, GLint z, GLint w)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex4iv_(const GLint *v)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex4s_(GLshort x, GLshort y, GLshort z, GLshort w)
{
	ER_ASSERT(0);
}

void APIENTRY glVertex4sv_(const GLshort *v)
{
	ER_ASSERT(0);
}

void APIENTRY glVertexPointer_(GLint size, GLenum type, GLsizei stride,
	const GLvoid *pointer)
{
	// JBB_TODO: Implement me.
}

void APIENTRY glViewport_(GLint x, GLint y, GLsizei width, GLsizei height)
{
	GLER_CHECK_CONTEXT();
	
	erSetViewport(s_context->er, x, y, width, height);
}

int WINAPI wglChoosePixelFormat_(HDC hdc, CONST PIXELFORMATDESCRIPTOR *ppfd)
{
	ER_ASSERT(0);
	return 0;
}

int WINAPI wglDescribePixelFormat_(HDC hdc, int iPixelFormat, UINT nBytes,
	LPPIXELFORMATDESCRIPTOR ppfd)
{
	ER_ASSERT(iPixelFormat <= glerGetPixelFormatCount());

	memcpy(ppfd, glerDescribePixelFormat(iPixelFormat),
		nBytes <= sizeof(PIXELFORMATDESCRIPTOR) ? nBytes : sizeof(PIXELFORMATDESCRIPTOR));

	return glerGetPixelFormatCount();
}
	
int WINAPI wglGetPixelFormat_(HDC hdc)
{
	ER_ASSERT(0);
	return 0;
}

BOOL WINAPI wglSetPixelFormat_(HDC hdc, int iPixelFormat,
	CONST PIXELFORMATDESCRIPTOR *ppfd)
{
	ER_UNUSED(ppfd);	
	ER_ASSERT(iPixelFormat <= glerGetPixelFormatCount());

	glerSetPixelFormat(iPixelFormat);
	
	return TRUE;
}

BOOL WINAPI wglSwapBuffers_(HDC hdc)
{
	if (s_context == NULL || s_context->hdc != hdc)
		return FALSE;
	
	//erClearColorBuffer(s_context->er, 0.0f, 1.0f, 0.0f, 1.0f);
	return erSwapBuffers(s_context->er) == ER_RESULT_OK;
}

BOOL WINAPI wglCopyContext_(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
{
	ER_ASSERT(0);
	return FALSE;
}

HGLRC WINAPI wglCreateContext_(HDC hdc)
{
	if (hdc == INVALID_HANDLE_VALUE || hdc == NULL)
		return NULL;
	
	return (HGLRC)glerCreateContext(hdc);
}

HGLRC WINAPI wglCreateLayerContext_(HDC hdc, int iLayerPane)
{
	ER_ASSERT(0);
	return 0;
}

BOOL WINAPI wglDeleteContext_(HGLRC hglrc)
{
	if (hglrc == INVALID_HANDLE_VALUE || hglrc == NULL)
		return FALSE;
		
	glerDestroyContext((GLERContext *)hglrc);

	return TRUE;
}

HGLRC WINAPI wglGetCurrentContext_(VOID)
{
	ER_ASSERT(0);
	return 0;
}

HDC WINAPI wglGetCurrentDC_(VOID)
{
	ER_ASSERT(0);
	return 0;
}

PROC WINAPI wglGetProcAddress_(LPCSTR lpscProc)
{
	return NULL;
}

BOOL WINAPI wglMakeCurrent_(HDC hdc, HGLRC hglrc)
{
	GLERContext *context;
	
	if (hdc == NULL && hglrc == NULL)
	{
		s_context = NULL;
		return TRUE;
	}
	
	context = (GLERContext *)hglrc;
	
	if (context->hdc != hdc)
		return FALSE;
		
	s_context = context;
	
	return TRUE;
}

BOOL WINAPI wglShareLists_(HGLRC hglrc1, HGLRC hglrc2)
{
	ER_ASSERT(0);
	return FALSE;
}

BOOL WINAPI wglUseFontBitmapsA_(HDC hdc, DWORD first, DWORD count, DWORD listBase)
{
	ER_ASSERT(0);
	return FALSE;
}

BOOL WINAPI wglUseFontBitmapsW_(HDC hdc, DWORD first, DWORD count, DWORD listBase)
{
	ER_ASSERT(0);
	return FALSE;
}

BOOL WINAPI wglUseFontOutlinesA_(HDC hdc, DWORD first, DWORD count, DWORD listBase,
	FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf)
{
	ER_ASSERT(0);
	return FALSE;
}

BOOL WINAPI wglUseFontOutlinesW_(HDC hdc, DWORD first, DWORD count, DWORD listBase,
	FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf)
{
	ER_ASSERT(0);
	return FALSE;
}

BOOL WINAPI wglDescribeLayerPlane_(HDC hdc, int iPixelFormat,
	int iLayerPane, UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd)
{
	ER_ASSERT(0);
	return FALSE;
}

int WINAPI wglSetLayerPaletteEntries_(HDC hdc, int iLayerPane,
	int iStart, int cEntries, CONST COLORREF *pcr)
{
	ER_ASSERT(0);
	return 0;
}

int WINAPI wglGetLayerPaletteEntries_(HDC hdc, int iLayerPlane,
	int iStart, int cEntries, COLORREF *pcr)
{
	ER_ASSERT(0);
	return 0;
}

BOOL WINAPI wglRealizeLayerPalette_(HDC hdc, int iLayerPlane, BOOL bRealize)
{
	ER_ASSERT(0);
	return FALSE;
}

BOOL WINAPI wglSwapLayerBuffers_(HDC hdc, UINT fuPlanes)
{
	ER_ASSERT(0);
	return FALSE;
}
